/*
 *  SSBaseSharedPanelController.m
 *  MESLib
 * 
 * Copyright 2003-2009 Starline Software Ltd
 * 
 * This file is part of MESLib.
 * 
 * MESLib is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * MESLib is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU Lesser General Public License for more details.
 * 
 * You should have received a copy of the GNU Lesser General Public License
 * along with MESLib. If not, see <http://www.gnu.org/licenses/>.
 */
//  Created by Tobias Haughton on Fri Jan 24 2003.
//

#import "SSBaseSharedPanelController.h"


@implementation SSBaseSharedPanelController

- (id)initWithWindowNibName:(NSString *)name
{
   if (self = [super initWithWindowNibName:name]) {
      needsUpdate = NO;

   }
   return self;
}

- (void)windowDidLoad {
   [super windowDidLoad];
   [self setMainWindow:[NSApp mainWindow]];
   [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(mainWindowChanged:) name:NSWindowDidBecomeMainNotification object:nil];
   [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(mainWindowResigned:) name:NSWindowDidResignMainNotification object:nil];
}

- (void)mainWindowChanged:(NSNotification *)notification {
   [self setMainWindow:[notification object]];
}

- (void)mainWindowResigned:(NSNotification *)notification {
   [self setMainWindow:nil];
}

- (void)setMainWindow:(NSWindow *)mainWindow {

}

- (IBAction)close:(id)sender
{
   [[self window] close];
}

- (void)dealloc
{
   [[NSNotificationCenter defaultCenter] removeObserver:self];

   [super dealloc];
}

@end
